#ifndef CONFIGHANDLER_H
#define CONFIGHANDLER_H

#include <QGSettings>
#include <QVariant>
#include <QDebug>
#include <QKeySequence>
#include "global/global.h"

class ConfigHandler
{
public:
    ConfigHandler();

    //设置界面-保存
    bool getCameraRecord();
    int getCurrentCamera();
    QString getSavePath();
    SaveFormat getSaveFormat();
    SaveResolution getResolution();
    SaveFrameRate getFrameRate();
    QString getMicrophone();
    SaveAction getCompletionAction();

    void setCameraRecord(bool iscameraRecord);
    void setCurrentCamera(int index);
    void setSavePath(QString savePath);
    void setSaveFormat(SaveFormat saveformat);
    void setResolution(SaveResolution resolution);
    void setFrameRate(SaveFrameRate frameRate);
    void setMicrophone(QString microphone);
    void setCompletionAction(SaveAction microphone);

    //设置界面-快捷键
    QString getInvokeScreencap();
    QString getStartRecording();
    QString getWindowRecording();
    QString getFullScreenRecording();
    QString getPauseRecording();
    QString getOpenMicrophone();

    void setInvokeScreencap(QString shortchut);
    void setStartRecording(QString shortchut);
    void setWindowRecording(QString shortchut);
    void setFullScreenRecording(QString shortchut);
    void setPauseRecording(QString shortchut);
    void setOpenMicrophone(QString shortchut);

    void setShortcut(ShortcutRec shortcut, QString value);
    QString getShortcut(ShortcutRec shortcut);

    bool getKylinscreencap();        //录屏是否启用
    bool getCloseAfterScreencap();   //录屏后是否被关闭
    bool isHaveSystemShortcut();     //是否有系统快捷键

    QString keyToLib(QString key);

private:
    QGSettings *m_Data = nullptr;
    QGSettings *m_usdMediaKeys = nullptr;
};

#endif // CONFIGHANDLER_H
